
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>Sqlite在Android上的一个Bug · 梦里茶</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.2">
        <meta name="author" content="陈伟航">
        
        
    
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-disqus/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-toggle-chapters/toggle.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
        <link rel="stylesheet" href="../../styles/website.css">
        
    
        
    
        
    
        
    
        
    
        
    


    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="../chromium.html" />
    
    
    <link rel="prev" href="cong-yuan-ma-kan-android-zhong-sqlite-shi-zen-mo-tong-guo-cursorwindow-du-db-de.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../">
            
                <a href="../">
            
                    
                    Android
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../activity/">
            
                <a href="../activity/">
            
                    
                    activity
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1.1" data-path="../activity/activity-si-zhong-qi-dong-mo-shi.html">
            
                <a href="../activity/activity-si-zhong-qi-dong-mo-shi.html">
            
                    
                    Activity四种启动模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.2" data-path="../activity/intent_flag.html">
            
                <a href="../activity/intent_flag.html">
            
                    
                    Intent Flag
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.3" data-path="../activity/duo-task-de-ying-yong.html">
            
                <a href="../activity/duo-task-de-ying-yong.html">
            
                    
                    多task的应用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.4" data-path="../activity/task-he-hui-tui-zhan.html">
            
                <a href="../activity/task-he-hui-tui-zhan.html">
            
                    
                    Task和回退栈
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="./">
            
                <a href="./">
            
                    
                    sqlite
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.2.1" data-path="cong-yuan-ma-kan-android-zhong-sqlite-shi-zen-mo-tong-guo-cursorwindow-du-db-de.html">
            
                <a href="cong-yuan-ma-kan-android-zhong-sqlite-shi-zen-mo-tong-guo-cursorwindow-du-db-de.html">
            
                    
                    【源码】CursorWindow读DB
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.2.2.2" data-path="sqlite-zai-android-shang-de-yi-ge-bug.html">
            
                <a href="sqlite-zai-android-shang-de-yi-ge-bug.html">
            
                    
                    Sqlite在Android上的一个Bug
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../chromium.html">
            
                <a href="../chromium.html">
            
                    
                    Chromium
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="../listview_db.html">
            
                <a href="../listview_db.html">
            
                    
                    ListView读取DB数据最佳实践
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="../androidproject-jie-gou.html">
            
                <a href="../androidproject-jie-gou.html">
            
                    
                    Android Project结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="../yi-ge-you-proguard-yu-fastjson-yin-qi-de-xie-an.html">
            
                <a href="../yi-ge-you-proguard-yu-fastjson-yin-qi-de-xie-an.html">
            
                    
                    一个由Proguard与FastJson引起的血案
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.7" data-path="../note.html">
            
                <a href="../note.html">
            
                    
                    琐碎的一些tips
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../../cv/">
            
                <a href="../../cv/">
            
                    
                    Computer Vision
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../../cv/feature.html">
            
                <a href="../../cv/feature.html">
            
                    
                    特征提取
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../../cv/utils.html">
            
                <a href="../../cv/utils.html">
            
                    
                    计算机视觉常用工具
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../../ml/">
            
                <a href="../../ml/">
            
                    
                    Machine Learning
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../../ml/trick/">
            
                <a href="../../ml/trick/">
            
                    
                    技巧
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1.1" data-path="../../ml/trick/imgnet_1h.html">
            
                <a href="../../ml/trick/imgnet_1h.html">
            
                    
                    FaceBook: 1 hour training ImageNet
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.1.2" data-path="../../ml/trick/l2_normalize.html">
            
                <a href="../../ml/trick/l2_normalize.html">
            
                    
                    L2 Norm与L2 normalize
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../../ml/ncs.html">
            
                <a href="../../ml/ncs.html">
            
                    
                    实践
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.2.1" data-path="../../ml/pratice/torch_best_practice.html">
            
                <a href="../../ml/pratice/torch_best_practice.html">
            
                    
                    Pytorch实验代码的亿些小细节
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../../ml/kit/">
            
                <a href="../../ml/kit/">
            
                    
                    工具
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.3.1" >
            
                <a target="_blank" href="https://github.com/ahangchen/GDLNotes">
            
                    
                    Tensorflow学习笔记
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3.2" data-path="../../ml/kit/mxnet.html">
            
                <a href="../../ml/kit/mxnet.html">
            
                    
                    MXNet踩坑手记
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3.3" data-path="../../ml/kit/pytorch.html">
            
                <a href="../../ml/kit/pytorch.html">
            
                    
                    PyTorch踩坑手记
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3.4" data-path="../../ml/kit/keras.html">
            
                <a href="../../ml/kit/keras.html">
            
                    
                    Keras踩坑手记
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3.5" data-path="../../ml/kit/mscnn.html">
            
                <a href="../../ml/kit/mscnn.html">
            
                    
                    mscnn
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3.6" data-path="../../ml/kit/matlab/">
            
                <a href="../../ml/kit/matlab/">
            
                    
                    Matlab
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.3.6.1" data-path="../../ml/kit/matlab/ripc_auto.html">
            
                <a href="../../ml/kit/matlab/ripc_auto.html">
            
                    
                    Matlab Remote IPC自动化数据处理
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../../ml/papers/">
            
                <a href="../../ml/papers/">
            
                    
                    Papers
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.4.1" data-path="../../ml/papers/classification/">
            
                <a href="../../ml/papers/classification/">
            
                    
                    Classification
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4.2" data-path="../../ml/papers/reid/">
            
                <a href="../../ml/papers/reid/">
            
                    
                    Re-identification
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.4.2.1" data-path="../../ml/papers/reid/tfusion.html">
            
                <a href="../../ml/papers/reid/tfusion.html">
            
                    
                    CVPR2018:TFusion完全解读
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4.2.2" data-path="../../ml/papers/reid/eccv2018_taudl.html">
            
                <a href="../../ml/papers/reid/eccv2018_taudl.html">
            
                    
                    ECCV2018:TAUDL
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4.2.3" data-path="../../ml/papers/reid/cuhk_sentimes.html">
            
                <a href="../../ml/papers/reid/cuhk_sentimes.html">
            
                    
                    CVPR2018:Graph+reid
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4.2.4" data-path="../../ml/papers/reid/reid.html">
            
                <a href="../../ml/papers/reid/reid.html">
            
                    
                    Person Re-identification
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4.2.5" data-path="../../ml/papers/reid/cvpr-reid.html">
            
                <a href="../../ml/papers/reid/cvpr-reid.html">
            
                    
                    CVPR2016 Re-id
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4.2.6" data-path="../../ml/papers/reid/reid-topo.html">
            
                <a href="../../ml/papers/reid/reid-topo.html">
            
                    
                    Camera topology and Person Re-id
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4.2.7" data-path="../../ml/papers/reid/deep_transfer_learning_person_reid.html">
            
                <a href="../../ml/papers/reid/deep_transfer_learning_person_reid.html">
            
                    
                    Deep transfer learning Person Re-id
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4.2.8" data-path="../../ml/papers/reid/evaluate.html">
            
                <a href="../../ml/papers/reid/evaluate.html">
            
                    
                    Evaluate
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.4.3" data-path="../../ml/papers/detection/">
            
                <a href="../../ml/papers/detection/">
            
                    
                    Object Detection
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.4.3.1" data-path="../../ml/papers/detection/rcnn.html">
            
                <a href="../../ml/papers/detection/rcnn.html">
            
                    
                    读论文系列·干货满满的RCNN
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4.3.2" data-path="../../ml/papers/detection/sppnet.html">
            
                <a href="../../ml/papers/detection/sppnet.html">
            
                    
                    读论文系列·SPP-net
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4.3.3" data-path="../../ml/papers/detection/fast_rcnn.html">
            
                <a href="../../ml/papers/detection/fast_rcnn.html">
            
                    
                    读论文系列·Fast RCNN
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4.3.4" data-path="../../ml/papers/detection/faster_rcnn.html">
            
                <a href="../../ml/papers/detection/faster_rcnn.html">
            
                    
                    读论文系列·Faster RCNN
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4.3.5" data-path="../../ml/papers/detection/yolo.html">
            
                <a href="../../ml/papers/detection/yolo.html">
            
                    
                    读论文系列·YOLO
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4.3.6" data-path="../../ml/papers/detection/ssd.html">
            
                <a href="../../ml/papers/detection/ssd.html">
            
                    
                    读论文系列·SSD
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4.3.7" data-path="../../ml/papers/detection/yolo23.html">
            
                <a href="../../ml/papers/detection/yolo23.html">
            
                    
                    读论文系列·YOLOv2 & YOLOv3
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4.3.8" data-path="../../ml/papers/detection/other.html">
            
                <a href="../../ml/papers/detection/other.html">
            
                    
                    读论文系列·detection其他文章推荐
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.4.4" data-path="../../ml/papers/mono_depth/">
            
                <a href="../../ml/papers/mono_depth/">
            
                    
                    Depth
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4.5" data-path="../../ml/papers/3d_vision/">
            
                <a href="../../ml/papers/3d_vision/">
            
                    
                    3D vision
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.4.5.1" data-path="../../ml/papers/3d_vision/datasets.html">
            
                <a href="../../ml/papers/3d_vision/datasets.html">
            
                    
                    数据集相关
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4.5.2" data-path="../../ml/papers/3d_vision/flow.html">
            
                <a href="../../ml/papers/3d_vision/flow.html">
            
                    
                    光流相关
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.4.6" data-path="../../ml/papers/ssah/">
            
                <a href="../../ml/papers/ssah/">
            
                    
                    Hashing
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.4.6.1" data-path="../../ml/papers/ssah/ssah.html">
            
                <a href="../../ml/papers/ssah/ssah.html">
            
                    
                    CVPR2018: SSAH
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.4.7" data-path="../../ml/papers/overview/">
            
                <a href="../../ml/papers/overview/">
            
                    
                    大杂烩
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.4.7.1" data-path="../../ml/papers/overview/cncc2017.html">
            
                <a href="../../ml/papers/overview/cncc2017.html">
            
                    
                    CNCC2017 琐记
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4.7.2" data-path="../../ml/papers/overview/eccv2016_hydra_ccnn.html">
            
                <a href="../../ml/papers/overview/eccv2016_hydra_ccnn.html">
            
                    
                    ECCV 2016 Hydra CCNN
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4.7.3" data-path="../../ml/papers/overview/cncc_cv.html">
            
                <a href="../../ml/papers/overview/cncc_cv.html">
            
                    
                    CNCC2017深度学习与跨媒体智能
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4.7.4" data-path="../../ml/papers/overview/mla_2016.html">
            
                <a href="../../ml/papers/overview/mla_2016.html">
            
                    
                    MLA2016笔记
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="../../ml/zzh_ml_notes/">
            
                <a href="../../ml/zzh_ml_notes/">
            
                    
                    《机器学习》（周志华）读书笔记
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.5.1" data-path="../../ml/zzh_ml_notes/melon/">
            
                <a href="../../ml/zzh_ml_notes/melon/">
            
                    
                    西瓜书概念整理
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.5.1.1" data-path="../../ml/zzh_ml_notes/melon/ch01.html">
            
                <a href="../../ml/zzh_ml_notes/melon/ch01.html">
            
                    
                    绪论
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5.1.2" data-path="../../ml/zzh_ml_notes/melon/ch02.html">
            
                <a href="../../ml/zzh_ml_notes/melon/ch02.html">
            
                    
                    模型评估与选择
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5.1.3" data-path="../../ml/zzh_ml_notes/melon/ch03.html">
            
                <a href="../../ml/zzh_ml_notes/melon/ch03.html">
            
                    
                    线性模型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5.1.4" data-path="../../ml/zzh_ml_notes/melon/ch04.html">
            
                <a href="../../ml/zzh_ml_notes/melon/ch04.html">
            
                    
                    决策树
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5.1.5" data-path="../../ml/zzh_ml_notes/melon/ch05.html">
            
                <a href="../../ml/zzh_ml_notes/melon/ch05.html">
            
                    
                    神经网络
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5.1.6" data-path="../../ml/zzh_ml_notes/melon/ch06.html">
            
                <a href="../../ml/zzh_ml_notes/melon/ch06.html">
            
                    
                    支持向量机
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5.1.7" data-path="../../ml/zzh_ml_notes/melon/ch07.html">
            
                <a href="../../ml/zzh_ml_notes/melon/ch07.html">
            
                    
                    贝叶斯分类器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5.1.8" data-path="../../ml/zzh_ml_notes/melon/ch08.html">
            
                <a href="../../ml/zzh_ml_notes/melon/ch08.html">
            
                    
                    集成学习
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5.1.9" data-path="../../ml/zzh_ml_notes/melon/ch09.html">
            
                <a href="../../ml/zzh_ml_notes/melon/ch09.html">
            
                    
                    聚类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5.1.10" data-path="../../ml/zzh_ml_notes/melon/ch10.html">
            
                <a href="../../ml/zzh_ml_notes/melon/ch10.html">
            
                    
                    降维与度量学习
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5.1.11" data-path="../../ml/zzh_ml_notes/melon/ch11.html">
            
                <a href="../../ml/zzh_ml_notes/melon/ch11.html">
            
                    
                    特征选择与稀疏学习
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5.1.12" data-path="../../ml/zzh_ml_notes/melon/ch12.html">
            
                <a href="../../ml/zzh_ml_notes/melon/ch12.html">
            
                    
                    计算学习理论
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5.1.13" data-path="../../ml/zzh_ml_notes/melon/ch13.html">
            
                <a href="../../ml/zzh_ml_notes/melon/ch13.html">
            
                    
                    半监督学习
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5.1.14" data-path="../../ml/zzh_ml_notes/melon/ch14.html">
            
                <a href="../../ml/zzh_ml_notes/melon/ch14.html">
            
                    
                    概率图模型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5.1.15" data-path="../../ml/zzh_ml_notes/melon/ch15.html">
            
                <a href="../../ml/zzh_ml_notes/melon/ch15.html">
            
                    
                    规则学习
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5.1.16" data-path="../../ml/zzh_ml_notes/melon/ch16.html">
            
                <a href="../../ml/zzh_ml_notes/melon/ch16.html">
            
                    
                    强化学习
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5.1.17" data-path="../../ml/zzh_ml_notes/melon/ch17.html">
            
                <a href="../../ml/zzh_ml_notes/melon/ch17.html">
            
                    
                    附录
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../../java/">
            
                <a href="../../java/">
            
                    
                    Java
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../../java/java-web/">
            
                <a href="../../java/java-web/">
            
                    
                    java web
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1.1" data-path="../../java/java-web/servlet-zu-zhi.html">
            
                <a href="../../java/java-web/servlet-zu-zhi.html">
            
                    
                    Servlet部署
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.1.2" data-path="../../java/java-web/note.html">
            
                <a href="../../java/java-web/note.html">
            
                    
                    琐碎的tips
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../../java/note.html">
            
                <a href="../../java/note.html">
            
                    
                    JNI
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../../java/note-1.html">
            
                <a href="../../java/note-1.html">
            
                    
                    Note
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="../../java/l1-new-delete.html">
            
                <a href="../../java/l1-new-delete.html">
            
                    
                    Effective Java笔记
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../../backend/">
            
                <a href="../../backend/">
            
                    
                    后端开发
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../../backend/design.html">
            
                <a href="../../backend/design.html">
            
                    
                    架构设计
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../../backend/db.html">
            
                <a href="../../backend/db.html">
            
                    
                    数据库
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="../../backend/note/">
            
                <a href="../../backend/note/">
            
                    
                    java web
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.3.1" data-path="../../backend/note/servlet-zu-zhi.html">
            
                <a href="../../backend/note/servlet-zu-zhi.html">
            
                    
                    Servlet部署
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3.2" data-path="../../backend/note/note.html">
            
                <a href="../../backend/note/note.html">
            
                    
                    琐碎的tips
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="../../backend/spring_boot.html">
            
                <a href="../../backend/spring_boot.html">
            
                    
                    Spring boot
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="../../backend/django.html">
            
                <a href="../../backend/django.html">
            
                    
                    django
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6" data-path="../../backend/concurrent.html">
            
                <a href="../../backend/concurrent.html">
            
                    
                    分布式
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../../note/">
            
                <a href="../../note/">
            
                    
                    Linux && Hardware
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../../note/ubuntu_init.html">
            
                <a href="../../note/ubuntu_init.html">
            
                    
                    Ubuntu安装与初始配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../../note/raspbian/">
            
                <a href="../../note/raspbian/">
            
                    
                    树莓派相关
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.2.1" data-path="../../note/raspbian/rtlwifi.html">
            
                <a href="../../note/raspbian/rtlwifi.html">
            
                    
                    树莓派3B+无线网卡监听模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2.2" data-path="../../note/raspbian/tlwr703n_openwrt.html">
            
                <a href="../../note/raspbian/tlwr703n_openwrt.html">
            
                    
                    TP-LINK TL-WR703N v1.7 openwrt flashing
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../../python/">
            
                <a href="../../python/">
            
                    
                    Python
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../../python/django.html">
            
                <a href="../../python/django.html">
            
                    
                    django
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="../../python/raw.html">
            
                <a href="../../python/raw.html">
            
                    
                    原生模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.3" data-path="../../python/design.html">
            
                <a href="../../python/design.html">
            
                    
                    设计模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.4" data-path="../../python/viz.html">
            
                <a href="../../python/viz.html">
            
                    
                    可视化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.5" data-path="../../python/libs.html">
            
                <a href="../../python/libs.html">
            
                    
                    常用库踩坑指南
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../../web-front/">
            
                <a href="../../web-front/">
            
                    
                    web前端
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.1" data-path="../../web-front/head_content.html">
            
                <a href="../../web-front/head_content.html">
            
                    
                    header div固定，content div填充父容器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.2" data-path="../../web-front/json_res.html">
            
                <a href="../../web-front/json_res.html">
            
                    
                    json接口资源
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="../../ui.html">
            
                <a href="../../ui.html">
            
                    
                    UI
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="../../kit/">
            
                <a href="../../kit/">
            
                    
                    kit
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.11.1" data-path="../../kit/note.html">
            
                <a href="../../kit/note.html">
            
                    
                    vim
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.2" data-path="../../kit/git/">
            
                <a href="../../kit/git/">
            
                    
                    git/github
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.11.2.1" data-path="../../kit/git/green_blush.html">
            
                <a href="../../kit/git/green_blush.html">
            
                    
                    刷爆github小绿点
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.11.3" data-path="../../kit/markdown/">
            
                <a href="../../kit/markdown/">
            
                    
                    Markdown/gitbook
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.11.3.1" data-path="../../kit/markdown/pieces.html">
            
                <a href="../../kit/markdown/pieces.html">
            
                    
                    琐碎知识点
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.3.2" data-path="../../kit/markdown/gitbook_disqus.html">
            
                <a href="../../kit/markdown/gitbook_disqus.html">
            
                    
                    gitbook添加disqus作为评论
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.3.3" data-path="../../kit/markdown/chrome_mark2_md.html">
            
                <a href="../../kit/markdown/chrome_mark2_md.html">
            
                    
                    导出chrome书签为Markdown
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.3.4" data-path="../../kit/markdown/wx_md.html">
            
                <a href="../../kit/markdown/wx_md.html">
            
                    
                    Markdown here && 微信公众号
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.11.4" data-path="../../kit/latex/">
            
                <a href="../../kit/latex/">
            
                    
                    LaTex
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.11.4.1" data-path="../../kit/latex/note.html">
            
                <a href="../../kit/latex/note.html">
            
                    
                    LaTex琐记
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.11.5" data-path="../../kit/ss.html">
            
                <a href="../../kit/ss.html">
            
                    
                    科学上网
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.6" data-path="../../kit/vmware.html">
            
                <a href="../../kit/vmware.html">
            
                    
                    虚拟机
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="../../thinking-in-program/">
            
                <a href="../../thinking-in-program/">
            
                    
                    thinking-in-program
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.12.1" data-path="../../thinking-in-program/log.html">
            
                <a href="../../thinking-in-program/log.html">
            
                    
                    怎样打日志
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="../../star.html">
            
                <a href="../../star.html">
            
                    
                    我的收藏
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="../../pieces/">
            
                <a href="../../pieces/">
            
                    
                    琐记
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.14.1" data-path="../../pieces/paper.html">
            
                <a href="../../pieces/paper.html">
            
                    
                    论文心得
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.15" data-path="../../support.html">
            
                <a href="../../support.html">
            
                    
                    赞赏支持
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >Sqlite在Android上的一个Bug</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="sqlite&#x5728;android&#x4E0A;&#x7684;&#x4E00;&#x4E2A;bug">Sqlite&#x5728;Android&#x4E0A;&#x7684;&#x4E00;&#x4E2A;Bug</h1>
<blockquote>
<p>SQLiteCantOpenDatabaseException: unable to open database file</p>
</blockquote>
<p>&#x5148;&#x4E0A;log</p>
<pre><code class="lang-text">12-14 19:51:30.346 17770-18098/com.company.product W/System.err: com.company.product.database.sqlite.SQLiteCantOpenDatabaseException: unable to open database file (code 14)

12-14 19:51:30.346 17770-18098/com.company.product W/System.err:     at com.company.product.database.sqlite.SQLiteConnection.nativeExecuteForCursorWindow(Native Method)

12-14 19:51:30.346 17770-18098/com.company.product W/System.err:     at com.company.product.database.sqlite.SQLiteConnection.executeForCursorWindow(SQLiteConnection.java:913)

12-14 19:51:30.346 17770-18098/com.company.product W/System.err:     at com.company.product.database.sqlite.SQLiteSession.executeForCursorWindow(SQLiteSession.java:819)

12-14 19:51:30.346 17770-18098/com.company.product W/System.err:     at com.company.product.database.sqlite.SQLiteQuery.fillWindow(SQLiteQuery.java:62)

12-14 19:51:30.346 17770-18098/com.company.product W/System.err:     at com.company.product.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:159)

12-14 19:51:30.346 17770-18098/com.company.product W/System.err:     at com.company.product.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:147)

12-14 19:51:30.346 17770-18098/com.company.product W/System.err:     at com.company.product.database.sqlite.AbstractCursor.moveToPosition(AbstractCursor.java:218)

12-14 19:51:30.346 17770-18098/com.company.product W/System.err:     at com.company.product.database.sqlite.AbstractCursor.moveToFirst(AbstractCursor.java:258)
</code></pre>
<p>&#x5148;&#x7ED9;&#x51FA;&#x7ED3;&#x8BBA;&#xFF0C;</p>
<ul>
<li><strong>&#x8FD9;&#x662F;sqlite&#x5728;Android&#x7CFB;&#x7EDF;&#x4E0A;&#x7684;&#x4E00;&#x4E2A;bug&#xFF0C;&#x5728;&#x9700;&#x8981;&#x5EFA;&#x7ACB;&#x7D22;&#x5F15;&#x7684;sql&#x8BED;&#x53E5;&#x9891;&#x7E41;&#x6267;&#x884C;&#x65F6;&#xFF0C;&#x4F1A;&#x53D1;&#x751F;&#x8FD9;&#x4E2A;&#x5F02;&#x5E38;&#x3002;</strong></li>
<li><strong>&#xFF08;&#x5982;&#x679C;&#x4F60;&#x662F;&#x5728;SQLiteDatabase&#x6267;&#x884C;open()&#x65F6;&#x770B;&#x5230;&#x7684;&#x8FD9;&#x4E2A;exception&#xFF0C;&#x90A3;&#x5E94;&#x8BE5;&#x662F;&#x7EBF;&#x7A0B;&#x51B2;&#x7A81;&#x7684;&#x95EE;&#x9898;&#xFF0C;&#x8DDF;&#x8FD9;&#x7BC7;&#x6587;&#x7AE0;&#x8BB2;&#x7684;&#x4E0D;&#x662F;&#x540C;&#x4E00;&#x4E2A;&#xFF09;</strong></li>
<li><strong>&#x6839;&#x672C;&#x539F;&#x56E0;&#x662F;sqlite&#x4E34;&#x65F6;&#x6587;&#x4EF6;&#x76EE;&#x5F55;&#x4E0D;&#x53EF;&#x7528;&#x3002;</strong></li>
<li><strong>&#x89E3;&#x51B3;&#x65B9;&#x6848;&#x662F;&#x7B2C;&#x4E00;&#x6B21;&#x5EFA;&#x7ACB;&#x8FDE;&#x63A5;&#x65F6;&#x8BBE;&#x7F6E;&#x4E34;&#x65F6;&#x6587;&#x4EF6;&#x76EE;&#x5F55;&#x3002;</strong></li>
</ul>
<p>&#x5728;&#x9879;&#x76EE;&#x91CC;&#x9047;&#x5230;&#x4E86;&#x8FD9;&#x6837;&#x4E00;&#x4E2A;&#x5947;&#x602A;&#x7684;crash&#xFF0C;&#x957F;&#x671F;&#x5360;&#x636E;&#x5404;&#x4E2A;&#x7248;&#x672C;crash&#x4E0A;&#x62A5;&#x699C;&#x9996;&#xFF0C;&#x4F46;&#x5728;&#x5F00;&#x53D1;&#x4E2D;&#x4E00;&#x76F4;&#x4E0D;&#x80FD;&#x91CD;&#x73B0;&#x3002;</p>
<p>&#x5728;&#x8BB8;&#x591A;&#x67E5;DB&#x7684;&#x4EE3;&#x7801;&#x8DEF;&#x5F84;&#x91CC;&#xFF0C;&#x90FD;&#x4F1A;&#x5728;moveToFirst()&#xFF0C;getCount()&#x7B49;&#x9700;&#x8981;&#x6267;&#x884C;fillWindow&#x7684;&#x5730;&#x65B9;&#x51FA;&#x73B0;&#x8FD9;&#x4E2A;crash&#x3002;</p>
<p> <strong>&#x7F51;&#x7EDC;&#x4E0A;&#x7684;&#x89E3;&#x51B3;&#x65B9;&#x6848;&#xFF1A;</strong></p>
<p>&#x8C37;&#x6B4C;&#x641C;&#x7D22;SQLiteCantOpenDatabaseException&#xFF0C;&#x591A;&#x662F;&#x4E00;&#x4E9B;&#x6267;&#x884C;SQLiteDatabase open()&#x65F6;&#x7EBF;&#x7A0B;&#x51B2;&#x7A81;&#x7684;&#x95EE;&#x9898;&#xFF0C;&#x4E0E;&#x6211;&#x4EEC;&#x8FD9;&#x4E2A;&#x95EE;&#x9898;&#x4E0D;&#x540C;&#x3002;</p>
<p>&#x8DDF;&#x8FD9;&#x4E2A;&#x95EE;&#x9898;&#x76F8;&#x5173;&#x7684;&#x56DE;&#x7B54;&#x5C48;&#x6307;&#x53EF;&#x6570;&#xFF0C;&#x4E00;&#x76F4;&#x6CA1;&#x627E;&#x5230;&#x89E3;&#x51B3;&#x65B9;&#x6848;&#xFF0C;&#x6700;&#x76F8;&#x5173;&#x7684;&#x4E24;&#x79CD;&#x56DE;&#x7B54;&#x6765;&#x81EA;github&#xFF1A;</p>
<p><a href="https://github.com/Raizlabs/DBFlow/issues/380" target="_blank">https://github.com/Raizlabs/DBFlow/issues/380</a></p>
<p><a href="https://github.com/dxopt/OpenFilesLeakTest/blob/master/bugs-show/AbstractCursor.moveToFirst.md" target="_blank">https://github.com/dxopt/OpenFilesLeakTest/blob/master/bugs-show/AbstractCursor.moveToFirst.md</a></p>
<p>&#x7B2C;&#x4E00;&#x4E2A;&#x94FE;&#x63A5;&#x4E0E;&#x6211;&#x4EEC;&#x7684;&#x60C5;&#x51B5;&#x76F8;&#x7B26;&#xFF0C;&#x4F46;&#x662F;&#x6CA1;&#x6709;&#x6839;&#x672C;&#x7684;&#x89E3;&#x51B3;&#x65B9;&#x6848;&#xFF0C;&#x53EA;&#x6709;try &#x2013; catch</p>
<p>&#x7B2C;&#x4E8C;&#x4E2A;&#x94FE;&#x63A5;&#x8BB2;&#x7684;&#x662F;FD&#x6CC4;&#x9732;&#x5BFC;&#x81F4;&#x6253;&#x4E0D;&#x5F00;&#x6587;&#x4EF6;&#xFF0C;&#x4E8E;&#x662F;&#x6211;&#x6392;&#x67E5;&#x4E86;app&#x4E2D;&#x5404;&#x79CD;&#x6CC4;&#x9732;&#x7684;&#x5730;&#x65B9;&#xFF0C;&#x5E76;&#x4E14;&#x5199;&#x4E86;&#x4E00;&#x4E2A;&#x8BA1;&#x7B97;&#x6587;&#x4EF6;&#x53E5;&#x67C4;&#x6570;&#x7684;&#x4E0A;&#x62A5;&#x5DE5;&#x5177;&#xFF0C;&#x53D1;&#x73B0;&#x7528;&#x6237;&#x53D1;&#x751F;&#x6B64;&#x7C7B;crash&#x65F6;&#xFF0C;FD&#x90FD;&#x4E0D;&#x8D85;&#x8FC7;256&#xFF0C;&#x4F4E;&#x4E8E;&#x7CFB;&#x7EDF;&#x5BF9;&#x5355;&#x4E2A;&#x8FDB;&#x7A0B;&#x9ED8;&#x8BA4;FD&#x6570;&#x91CF;1024&#x7684;&#x9650;&#x5236;&#x3002;&#x6392;&#x9664;&#x8FD9;&#x4E2A;&#x53EF;&#x80FD;&#x3002;</p>
<p>&#xFF08;&#x4F46;&#x6709;&#x4E9B;&#x65F6;&#x5019;&#x4E5F;&#x6709;&#x53EF;&#x80FD;&#x662F;&#x7531;&#x8FD9;&#x4E2A;&#x95EE;&#x9898;&#x5F15;&#x53D1;&#x7684;&#xFF0C;&#x53EF;&#x4EE5;&#x7528;StrictMode detectLeak&#x53BB;&#x6392;&#x67E5;&#xFF09;</p>
<p>&#x4E8E;&#x662F;&#x5148;&#x5C1D;&#x8BD5;&#x5728;&#x4E00;&#x4E9B;&#x53EF;&#x80FD;&#x89E6;&#x53D1;&#x8FD9;&#x4E2A;Exception&#x7684;&#x5730;&#x65B9;try-catch</p>
<p>&#x518D;&#x5206;&#x6790;&#x7528;&#x6237;&#x65E5;&#x5FD7;&#xFF0C;&#x53D1;&#x73B0;try &#x2013; catch&#x4F4F;&#x8FD9;&#x4E2A;Exception&#x540E;&#x662F;&#x53EF;&#x4EE5;&#x7EE7;&#x7EED;&#x6267;&#x884C;&#x4E00;&#x4E9B;DB&#x67E5;&#x8BE2;&#x7684;&#xFF0C;</p>
<p>&#x4E8E;&#x662F;&#x5168;&#x90FD;&#x4E0A;&#x4E86;try &#x2013; catch</p>
<p> <strong>&#x91CD;&#x73B0;&#x8DEF;&#x5F84;</strong></p>
<p>&#x5206;&#x6790;&#x7528;&#x6237;&#x65E5;&#x5FD7;&#xFF0C;&#x53D1;&#x73B0;&#x7528;&#x6237;&#x7684;&#x4E00;&#x4E9B;&#x5171;&#x6027;&#xFF0C;&#x7531;&#x4E8E;&#x4E1A;&#x52A1;&#x4FDD;&#x5BC6;&#x9650;&#x5236;&#x8FD9;&#x91CC;&#x603B;&#x7ED3;&#x4E00;&#x4E0B;&#xFF0C;&#x5171;&#x6027;&#x662F;DB&#x4E2D;&#x6570;&#x636E;&#x91CF;&#x5F88;&#x5927;&#xFF0C;&#x5E76;&#x4E14;&#x67E5;&#x8BE2;&#x4E2D;&#x6709;&#x5927;&#x91CF;&#x7684;&#x5B50;&#x67E5;&#x8BE2;&#x3002;</p>
<p>&#x4E8E;&#x662F;&#x5C1D;&#x8BD5;&#x91CD;&#x73B0;&#x8FD9;&#x4E2A;&#x95EE;&#x9898;&#xFF1A;</p>
<p>&#x5728;&#x6570;&#x636E;&#x91CF;&#x5F88;&#x5927;&#x7684;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x591A;&#x6B21;&#x67E5;&#x8BE2;&#x5C31;&#x4F1A;&#x91CD;&#x73B0;&#x3002;</p>
<p>&#x53EF;&#x4EE5;&#x91CD;&#x73B0;&#x7684;&#x8BDD;&#x5C31;&#x53EF;&#x4EE5;&#x5F00;&#x59CB;&#x6253;log&#x4E86;&#x3002;</p>
<p>&#x4E3A;&#x4E86;&#x5728;sqlite native&#x5C42;&#x6253;log&#xFF0C;&#x7F16;&#x8BD1;sqlite&#xFF0C;&#x4F7F;&#x7528;sqlite3_log&#x6765;&#x8F93;&#x51FA;&#x81EA;&#x5DF1;&#x60F3;&#x89C2;&#x5BDF;&#x7684;&#x4FE1;&#x606F;&#x3002;</p>
<p>&#x9996;&#x5148;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x770B;&#x5230;sqlite&#x7684;log</p>
<pre><code class="lang-text">12-14 19:51:30.346 17770-18098/com.company.package E/SQLiteLog: (14) cannot open file at line 32440 of [bda77dda96]

12-14 19:51:30.346 17770-18098/com.company.package E/SQLiteLog: (14) os_unix.c:32440: (30) open(./etilqs_3P2SKRP0Ge6cj3T) -

12-14 19:51:30.346 17770-18098/com.company.package E/SQLiteLog: (14) statement aborts at 180: [SELECT M.*,&#x2026;&#x2026;&#x2026;&#x2026;&#x2026;&#x2026;&#x2026;
</code></pre>
<p>&#x53EF;&#x4EE5;&#x770B;&#x5230;&#x662F;&#x6253;&#x5F00;&#x4E00;&#x4E2A;&#x201D;./etilqs_3P2SKRP0Ge6cj3T&#x201D;&#x7684;&#x6587;&#x4EF6;&#x65F6;&#x6253;&#x5F00;&#x5931;&#x8D25;&#x3002;</p>
<p>&#x5148;&#x67E5;&#x67E5;&#x8FD9;&#x4E2A;&#x4E34;&#x65F6;&#x6587;&#x4EF6;&#x662F;&#x4EC0;&#x4E48;&#x9B3C;&#xFF0C;</p>
<p>&#x5728;sqlite3.c&#x641C;&#x7D22;&#x524D;&#x7F00;etilqs_&#x91CC;&#x53EF;&#x4EE5;&#x770B;&#x5230;&#x8FD9;&#x6837;&#x7684;&#x6CE8;&#x91CA;&#xFF1A;</p>
<pre><code class="lang-c"><span class="hljs-comment">/*
** Temporary files are named starting with this prefix followed by 16 random
** alphanumeric characters, and no file extension. They are stored in the
** OS&apos;s standard temporary file directory, and are deleted prior to exit.
** If sqlite is being embedded in another program, you may wish to change the
** prefix to reflect your program&apos;s name, so that if your program exits
** prematurely, old temporary files can be easily identified. This can be done
** using -DSQLITE_TEMP_FILE_PREFIX=myprefix_ on the compiler command line.
**
** 2006-10-31:  The default prefix used to be &quot;sqlite_&quot;.  But then
** Mcafee started using SQLite in their anti-virus product and it
** started putting files with the &quot;sqlite&quot; name in the c:/temp folder.
** This annoyed many windows users.  Those users would then do a 
** Google search for &quot;sqlite&quot;, find the telephone numbers of the
** developers and call to wake them up at night and complain.
** For this reason, the default name prefix is changed to be &quot;sqlite&quot; 
** spelled backwards.  So the temp files are still identified, but
** anybody smart enough to figure out the code is also likely smart
** enough to know that calling the developer will not help get rid
** of the file.
*/</span>
<span class="hljs-meta">#<span class="hljs-meta-keyword">ifndef</span> SQLITE_TEMP_FILE_PREFIX</span>
<span class="hljs-meta"># <span class="hljs-meta-keyword">define</span> SQLITE_TEMP_FILE_PREFIX <span class="hljs-string">&quot;etilqs_&quot;</span></span>
<span class="hljs-meta">#<span class="hljs-meta-keyword">endif</span></span>
</code></pre>
<p>&#x603B;&#x4E4B;&#x5C31;&#x662F;&#x4E34;&#x65F6;&#x6587;&#x4EF6;&#x5C31;&#x5BF9;&#x4E86;&#x3002;</p>
<p><strong>&#x4E34;&#x65F6;&#x6587;&#x4EF6;&#x6E90;&#x7801;&#x8FFD;&#x8E2A;</strong></p>
<p>&#x7136;&#x540E;&#x627E;&#x627E;&#x8FD9;&#x4E2A;&#x4E1C;&#x897F;&#x5728;&#x54EA;&#x91CC;&#x7528;&#x7684;&#xFF0C;</p>
<pre><code class="lang-c"><span class="hljs-comment">/*
** Create a temporary file name in zBuf.  zBuf must be allocated
** by the calling process and must be big enough to hold at least
** pVfs-&gt;mxPathname bytes.
*/</span>
<span class="hljs-function"><span class="hljs-keyword">static</span> <span class="hljs-keyword">int</span> <span class="hljs-title">unixGetTempname</span><span class="hljs-params">(<span class="hljs-keyword">int</span> nBuf, <span class="hljs-keyword">char</span> *zBuf)</span></span>{
  <span class="hljs-keyword">static</span> <span class="hljs-keyword">const</span> <span class="hljs-keyword">unsigned</span> <span class="hljs-keyword">char</span> zChars[] =
    <span class="hljs-string">&quot;abcdefghijklmnopqrstuvwxyz&quot;</span>
    <span class="hljs-string">&quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ&quot;</span>
    <span class="hljs-string">&quot;0123456789&quot;</span>;
  <span class="hljs-keyword">unsigned</span> <span class="hljs-keyword">int</span> i, j;
  <span class="hljs-keyword">const</span> <span class="hljs-keyword">char</span> *zDir;

  <span class="hljs-comment">/* It&apos;s odd to simulate an io-error here, but really this is just
  ** using the io-error infrastructure to test that SQLite handles this
  ** function failing. 
  */</span>
  SimulateIOError( <span class="hljs-keyword">return</span> SQLITE_IOERR );

  zDir = unixTempFileDir();
  <span class="hljs-keyword">if</span>( zDir==<span class="hljs-number">0</span> ) zDir = <span class="hljs-string">&quot;.&quot;</span>;

  <span class="hljs-comment">/* Check that the output buffer is large enough for the temporary file 
  ** name. If it is not, return SQLITE_ERROR.
  */</span>
  <span class="hljs-keyword">if</span>( (<span class="hljs-built_in">strlen</span>(zDir) + <span class="hljs-built_in">strlen</span>(SQLITE_TEMP_FILE_PREFIX) + <span class="hljs-number">18</span>) &gt;= (<span class="hljs-keyword">size_t</span>)nBuf ){
    <span class="hljs-keyword">return</span> SQLITE_ERROR;
  }

  <span class="hljs-keyword">do</span>{
    sqlite3_snprintf(nBuf<span class="hljs-number">-18</span>, zBuf, <span class="hljs-string">&quot;%s/&quot;</span>SQLITE_TEMP_FILE_PREFIX, zDir);
    j = (<span class="hljs-keyword">int</span>)<span class="hljs-built_in">strlen</span>(zBuf);
    sqlite3_randomness(<span class="hljs-number">15</span>, &amp;zBuf[j]);
    <span class="hljs-keyword">for</span>(i=<span class="hljs-number">0</span>; i&lt;<span class="hljs-number">15</span>; i++, j++){
      zBuf[j] = (<span class="hljs-keyword">char</span>)zChars[ ((<span class="hljs-keyword">unsigned</span> <span class="hljs-keyword">char</span>)zBuf[j])%(<span class="hljs-keyword">sizeof</span>(zChars)<span class="hljs-number">-1</span>) ];
    }
    zBuf[j] = <span class="hljs-number">0</span>;
    zBuf[j+<span class="hljs-number">1</span>] = <span class="hljs-number">0</span>;
  }<span class="hljs-keyword">while</span>( osAccess(zBuf,<span class="hljs-number">0</span>)==<span class="hljs-number">0</span> );
  <span class="hljs-keyword">return</span> SQLITE_OK;
}
</code></pre>
<p>&#x8FD9;&#x91CC;&#x53EF;&#x4EE5;&#x7559;&#x610F;&#x5230;&#x4E00;&#x4E2A;&#x795E;&#x5947;&#x7684;&#x4E1C;&#x897F;</p>
<p><strong>zDir = unixTempFileDir();</strong></p>
<p><strong>if( zDir==0 ) zDir = &quot;.&quot;;</strong> &#x6211;&#x4EEC;&#x7684;&#x6587;&#x4EF6;&#x662F; <strong>./etilqs_3P2SKRP0Ge6cj3T</strong></p>
<p>&#x6240;&#x4EE5;<strong>unixTempFileDir()</strong>&#x786E;&#x5B9E;&#x662F;&#x8FD4;&#x56DE;&#x4E86;0</p>
<p>&#x90A3;&#x518D;&#x770B;&#x4E0B;<strong>unixTempFileDir();</strong></p>
<pre><code class="lang-c"><span class="hljs-comment">/*
** Return the name of a directory in which to put temporary files.
** If no suitable temporary file directory can be found, return NULL.
*/</span>
<span class="hljs-function"><span class="hljs-keyword">static</span> <span class="hljs-keyword">const</span> <span class="hljs-keyword">char</span> *<span class="hljs-title">unixTempFileDir</span><span class="hljs-params">(<span class="hljs-keyword">void</span>)</span></span>{
  <span class="hljs-keyword">static</span> <span class="hljs-keyword">const</span> <span class="hljs-keyword">char</span> *azDirs[] = {
     <span class="hljs-number">0</span>,
     <span class="hljs-number">0</span>,
     <span class="hljs-number">0</span>,
     <span class="hljs-string">&quot;/var/tmp&quot;</span>,
     <span class="hljs-string">&quot;/usr/tmp&quot;</span>,
     <span class="hljs-string">&quot;/tmp&quot;</span>,
       <span class="hljs-comment">/* List terminator */</span>
  };
  <span class="hljs-keyword">unsigned</span> <span class="hljs-keyword">int</span> i;
  <span class="hljs-keyword">struct</span> stat buf;
  <span class="hljs-keyword">const</span> <span class="hljs-keyword">char</span> *zDir = <span class="hljs-number">0</span>;

  azDirs[<span class="hljs-number">0</span>] = sqlite3_temp_directory;
  <span class="hljs-keyword">if</span>( !azDirs[<span class="hljs-number">1</span>] ) azDirs[<span class="hljs-number">1</span>] = getenv(<span class="hljs-string">&quot;SQLITE_TMPDIR&quot;</span>);
  <span class="hljs-keyword">if</span>( !azDirs[<span class="hljs-number">2</span>] ) azDirs[<span class="hljs-number">2</span>] = getenv(<span class="hljs-string">&quot;TMPDIR&quot;</span>);
  <span class="hljs-keyword">for</span>(i=<span class="hljs-number">0</span>; i&lt;<span class="hljs-keyword">sizeof</span>(azDirs)/<span class="hljs-keyword">sizeof</span>(azDirs[<span class="hljs-number">0</span>]); zDir=azDirs[i++]){
    <span class="hljs-keyword">if</span>( zDir==<span class="hljs-number">0</span> ) <span class="hljs-keyword">continue</span>;
    <span class="hljs-keyword">if</span>( osStat(zDir, &amp;buf) ) <span class="hljs-keyword">continue</span>;
    <span class="hljs-keyword">if</span>( !S_ISDIR(buf.st_mode) ) <span class="hljs-keyword">continue</span>;
    <span class="hljs-keyword">if</span>( osAccess(zDir, <span class="hljs-number">07</span>) ) <span class="hljs-keyword">continue</span>;
    <span class="hljs-keyword">break</span>;
  }
  <span class="hljs-keyword">return</span> zDir;
}
</code></pre>
<p>azDirs[0]&#x662F;sqlite3_temp_directory&#xFF0C;&#x6211;&#x4EEC;&#x6CA1;&#x6709;&#x8BBE;&#x7F6E;&#x8FC7;&#xFF0C;</p>
<p>azDirs[1]&#x548C;[2]&#x662F;&#x73AF;&#x5883;&#x53D8;&#x91CF;&#xFF0C;&#x7528;sqlite3_log&#x6253;&#x51FA;&#x6765;&#x662F;</p>
<p><img src="../../.gitbook/assets/780612-20151220203024664-638008562.png" alt=""></p>
<p>&#x5373;&#x73AF;&#x5883;&#x53D8;&#x91CF;&#x91CC;&#x6CA1;&#x6709;&#x8BBE;&#x7F6E;&#x8FD9;&#x4E24;&#x4E2A;&#x503C;&#xFF0C;</p>
<p>&#x800C;&#x53E6;&#x5916;&#x4E09;&#x4E2A;&#x76EE;&#x5F55;/var/tmp&#xFF0C;/usr/tmp&#xFF0C;/tmp&#x5728;Android&#x7CFB;&#x7EDF;&#x91CC;&#x90FD;&#x662F;&#x5E94;&#x7528;&#x4E0D;&#x53EF;&#x5199;&#x7684;&#xFF0C;</p>
<p>&#x6240;&#x4EE5;&#x4F1A;&#x8FD4;&#x56DE;0&#x7ED9;unixGetTemp&#xFF0C;</p>
<p>&#x4E8E;&#x662F;unixGetTemp&#x4F7F;&#x7528;&#x4E86;&#x201D;.&#x201D;&#x4F5C;&#x4E3A;&#x4E34;&#x65F6;&#x6587;&#x4EF6;&#x7684;&#x76EE;&#x5F55;&#xFF0C;</p>
<p>&#x90A3;&#x201D;.&#x201D;&#x662F;&#x54EA;&#x4E2A;&#x76EE;&#x5F55;&#x5462;&#xFF1F;</p>
<p>&#x4F7F;&#x7528;</p>
<pre><code class="lang-c">system(&#x201C;ls . &gt;  /sdcard/<span class="hljs-number">0.</span>txt&#x201D;);
</code></pre>
<p>&#x7ED3;&#x679C;&#x662F;&#xFF1A;</p>
<pre><code class="lang-text">acct
adb_keys
cache
config
d
data
default.prop
dev
etc
firmware
fstab.qcom
init
init.goldfish.rc
init.qcom.class_core.sh
init.qcom.class_main.sh
init.qcom.rc
init.qcom.sh
init.qcom.usb.rc
init.qcom.usb.sh
init.rc
init.target.rc
init.trace.rc
init.usb.rc
mnt
persist
proc
root
sbin
sdcard
storage
storage_int
sys
system
tombstones
ueventd.goldfish.rc
ueventd.qcom.rc
ueventd.rc
vendor
</code></pre>
<p>&#x8FD9;&#x7279;&#x4E48;&#x662F;&#x6839;&#x76EE;&#x5F55;&#xFF01;&#x5F53;&#x524D;&#x5DE5;&#x4F5C;&#x76EE;&#x5F55;&#x662F;&#x6839;&#x76EE;&#x5F55;&#x6211;&#x4E5F;&#x662F;&#x9189;&#x4E86;&#x3002;&#x3002;&#x3002;</p>
<p>&#x6240;&#x4EE5;&#x5728;&#x6839;&#x76EE;&#x5F55;&#x521B;&#x5EFA;&#x4E34;&#x65F6;&#x6587;&#x4EF6;&#x4E00;&#x5B9A;&#x4F1A;&#x5931;&#x8D25;&#xFF01;</p>
<p><strong>etilqs&#x4E34;&#x65F6;&#x6587;&#x4EF6;&#x521B;&#x5EFA;&#x65F6;&#x673A;</strong></p>
<p>&#x90A3;&#x4E3A;&#x4EC0;&#x4E48;&#x5E73;&#x65F6;&#x4F7F;&#x7528;&#x90FD;&#x662F;&#x6B63;&#x5E38;&#x7684;&#x5462;&#xFF1F;</p>
<p>&#x627E;&#x4E00;&#x627E;&#x8FD9;&#x4E2A;&#x4E34;&#x65F6;&#x6587;&#x4EF6;&#x7684;&#x521B;&#x5EFA;&#x65F6;&#x673A;&#xFF1A;</p>
<p>&#x5728;unixGetTempname&#x51FD;&#x6570;&#x91CC;&#xFF0C;&#x4EBA;&#x4E3A;&#x5730;&#x9020;&#x4E00;&#x4E2A;crash&#xFF0C;&#x901A;&#x8FC7;crash&#x5806;&#x6808;&#x914D;&#x5408;addr2line&#x6765;&#x67E5;&#x770B;&#x8C03;&#x7528;&#x6808;&#xFF1A;</p>
<pre><code class="lang-text">12-19 21:00:45.633 13680-14105/com.company.package E/SQLiteLog: (14) pagerstress;/data/data/com.company.package/databases/push
12-19 21:00:45.633 13680-14105/com.company.package E/SQLiteLog: (14) pager_write_pagelist
12-19 21:00:46.083 3727-3727/? I/DEBUG:     #00  pc 00037202  /data/app-lib/com.company.package-1/libqmsqlite.so unixGetTempname 32107
12-19 21:00:46.083 3727-3727/? I/DEBUG:     #01  pc 000376a7  /data/app-lib/com.company.package-1/libqmsqlite.so unixOpen 32396
12-19 21:00:46.083 3727-3727/? I/DEBUG:     #02  pc 00015ec5  /data/app-lib/com.company.package-1/libqmsqlite.so sqlite3OsOpen 17420
12-19 21:00:46.083 3727-3727/? I/DEBUG:     #03  pc 0003a16b  /data/app-lib/com.company.package-1/libqmsqlite.so
12-19 21:00:46.093 3727-3727/? I/DEBUG:     #04  pc 0003e0c7  /data/app-lib/com.company.package-1/libqmsqlite.so
12-19 21:00:46.093 3727-3727/? I/DEBUG:     #05  pc 00038e75  /data/app-lib/com.company.package-1/libqmsqlite.so
12-19 21:00:46.093 3727-3727/? I/DEBUG:     #06  pc 00038f55  /data/app-lib/com.company.package-1/libqmsqlite.so
12-19 21:00:46.093 3727-3727/? I/DEBUG:     #07  pc 00039445  /data/app-lib/com.company.package-1/libqmsqlite.so
12-19 21:00:46.093 3727-3727/? I/DEBUG:     #08  pc 0003add1  /data/app-lib/com.company.package-1/libqmsqlite.so
12-19 21:00:46.093 3727-3727/? I/DEBUG:     #09  pc 0003c1f1  /data/app-lib/com.company.package-1/libqmsqlite.so
12-19 21:00:46.093 3727-3727/? I/DEBUG:     #10  pc 0003d8df  /data/app-lib/com.company.package-1/libqmsqlite.so
12-19 21:00:46.093 3727-3727/? I/DEBUG:     #11  pc 0004c2e7  /data/app-lib/com.company.package-1/libqmsqlite.so
12-19 21:00:46.093 3727-3727/? I/DEBUG:     #12  pc 0004e317  /data/app-lib/com.company.package-1/libqmsqlite.so (sqlite3_step+334)
12-19 21:00:46.093 3727-3727/? I/DEBUG:     #13  pc 00063ebd  /data/app-lib/com.company.package-1/libqmsqlite.so (sqlite3_blocking_step+6)
12-19 21:00:46.093 3727-3727/? I/DEBUG:     #14  pc 00012279  /data/app-lib/com.company.package-1/libqmsqlite.so
12-19 21:00:46.103 3727-3727/? I/DEBUG:          61e75c04  61ced1f7  /data/app-lib/com.company.package-1/libqmsqlite.so
12-19 21:00:46.103 3727-3727/? I/DEBUG:          61e75c24  61ced6ab  /data/app-lib/com.company.package-1/libqmsqlite.so
12-19 21:00:46.103 3727-3727/? I/DEBUG:          61e75c50  61d71f4c  /data/app-lib/com.company.package-1/libqmsqlite.so
12-19 21:00:46.113 3727-3727/? I/DEBUG:          61e7610c  61cf016f  /data/app-lib/com.company.package-1/libqmsqlite.so
</code></pre>
<p>&#x4F7F;&#x7528;addr2line &#x2013;C &#x2013;f &#x2013;e &#x52A0;&#x4E0A;&#x9762;14&#x4E2A;pc&#x5730;&#x5740;&#xFF0C;&#x7ED3;&#x679C;&#xFF1A;</p>
<pre><code class="lang-text">pagerOpentemp
/media/Software/company/qmsqlite/jni/sqlite/sqlite3.c:46566
pagerStress
/media/Software/company/qmsqlite/jni/sqlite/sqlite3.c:47482
sqlite3PcacheFetchStress
/media/Software/company/qmsqlite/jni/sqlite/sqlite3.c:40751
btreeGetPage
/media/Software/company/qmsqlite/jni/sqlite/sqlite3.c:56428
btreeGetUnusedPage
/media/Software/company/qmsqlite/jni/sqlite/sqlite3.c:56556
allocateBtreePage
/media/Software/company/qmsqlite/jni/sqlite/sqlite3.c:60283
balance_nonroot
/media/Software/company/qmsqlite/jni/sqlite/sqlite3.c:61869
sqlite3BtreeInsert
/media/Software/company/qmsqlite/jni/sqlite/sqlite3.c:62554
sqlite3VdbeExec
/media/Software/company/qmsqlite/jni/sqlite/sqlite3.c:77746 (discriminator 3)
sqlite3Step
/media/Software/company/qmsqlite/jni/sqlite/sqlite3.c:71550
sqlite3_blocking_step
/media/Software/company/qmsqlite/jni/sqlite/sqlite3_unlock_notify.c:85 (discriminator 1)
nativeExecuteForCursorWindow
/media/Software/company/qmsqlite/jni/sqlite/SQLiteConnection.cpp:994
</code></pre>
<p><img src="../../.gitbook/assets/780612-20151220203807429-73523169.jpg" alt=""></p>
<p><strong>&#x61D2;&#x5F97;&#x770B;&#x56FE;&#x7684;&#x7AE5;&#x978B;&#x8FD8;&#x662F;&#x542C;&#x6211;&#x8BF4;&#x5427;&#xFF0C;</strong></p>
<p>&#x5148;&#x770B;sqlite&#x7684;architecture</p>
<p><img src="../../.gitbook/assets/780612-20151220203837633-715688502.gif" alt=""></p>
<p>&#x56E0;&#x4E3A;&#x6211;&#x4EEC;crash&#x7684;&#x5730;&#x65B9;&#x662F;&#x67E5;DB&#x7684;&#x5730;&#x65B9;&#xFF0C;&#x6240;&#x4EE5;&#x62FF;query&#x64CD;&#x4F5C;&#x6765;&#x89E3;&#x91CA;&#x8FD9;&#x4E2A;architecture&#x662F;&#x600E;&#x4E48;&#x8FD0;&#x884C;&#x7684;</p>
<p>&#x5148;&#x7528;SQL Command Processor&#x89E3;&#x6790;sql&#x8BED;&#x53E5;&#xFF0C;&#x53D8;&#x6210;&#x7C7B;&#x4F3C;&#x6C47;&#x7F16;&#x7684;&#x547D;&#x4EE4;&#x7ED9;Virtual Machine&#x6267;&#x884C;&#xFF0C;</p>
<p>&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x7528;explain plan select &#x2026;. &#x8FD9;&#x6837;&#x7684;&#x8BED;&#x53E5;&#x6765;&#x67E5;&#x770B;virtual machine&#x8981;&#x6267;&#x884C;&#x7684;&#x547D;&#x4EE4;&#xFF0C;&#x6BD4;&#x5982;</p>
<pre><code class="lang-sql"><span class="hljs-keyword">explain</span> plan <span class="hljs-keyword">select</span> * <span class="hljs-keyword">from</span> A <span class="hljs-keyword">where</span> A.a <span class="hljs-keyword">in</span> (<span class="hljs-keyword">select</span> b <span class="hljs-keyword">from</span> B)
</code></pre>
<p>&#x5BF9;&#x5E94;&#x7684;&#x547D;&#x4EE4;&#x662F;&#xFF1A;</p>
<pre><code class="lang-text"> 0| Trace| 0| 0| 0| | 00
 1| Goto| 0| 56| 0| | 00
 2| OpenRead| 0| 4| 0| 13| 00
 3| Rewind| 0| 54| 0| | 00
 4| null| 0| 1| 0| | 00
 5| Once| 0| 17| 0| | 00
 6| null| 0| 1| 0| | 00
 7| OpenEphemeral| 4| 1| 0| keyinfo(1,BINARY)| 00
 8| Integer| 10000| 2| 0| | 00
 9| OpenRead| 1| 5| 0| 1| 00
 10| Rewind| 1| 16| 0| | 00
 11| Column| 1| 0| 3| | 00
 12| MakeRecord| 3| 1| 4| b| 00
 13| IdxInsert| 4| 4| 0| | 00
 14| IfZero| 2| 16| -1| | 00
 15| Next| 1| 11| 0| | 01
 16| Close| 1| 0| 0| | 00
 17| Column| 0| 0| 4| | 00
 18| IsNull| 4| 22| 0| | 00
 19| Affinity| 4| 1| 0| b| 00
 20| NotFound| 4| 22| 4| 1| 00
 21| Goto| 0| 39| 0| | 00
 22| null| 0| 5| 0| | 00
 23| Once| 1| 35| 0| | 00
 24| null| 0| 5| 0| | 00
 25| OpenEphemeral| 6| 1| 0| keyinfo(1,BINARY)| 00
 26| Integer| 10000| 6| 0| | 00
 27| OpenRead| 2| 5| 0| 12| 00
 28| Rewind| 2| 34| 0| | 00
 29| Column| 2| 11| 7| | 00
 30| MakeRecord| 7| 1| 4| b| 00
 31| IdxInsert| 6| 4| 0| | 00
 32| IfZero| 6| 34| -1| | 00
 33| Next| 2| 29| 0| | 01
 34| Close| 2| 0| 0| | 00
 35| Column| 0| 1| 4| | 00
 36| IsNull| 4| 53| 0| | 00
 37| Affinity| 4| 1| 0| b| 00
 38| NotFound| 6| 53| 4| 1| 00
 39| Column| 0| 0| 8| | 00
 40| Column| 0| 1| 9| | 00
 41| Column| 0| 2| 10| | 00
 42| Column| 0| 3| 11| | 00
 43| Column| 0| 4| 12| | 00
 44| Column| 0| 5| 13| | 00
 45| Column| 0| 6| 14| | 00
 46| Column| 0| 7| 15| | 00
 47| Column| 0| 8| 16| | 00
 48| Column| 0| 9| 17| | 00
 49| Column| 0| 10| 18| | 00
 50| Column| 0| 11| 19| | 00
 51| Column| 0| 12| 20| | 00
 52| ResultRow| 8| 13| 0| | 00
 53| Next| 0| 4| 0| | 01
 54| Close| 0| 0| 0| | 00
 55| Halt| 0| 0| 0| | 00
 56| Transaction| 0| 0| 0| | 00
 57| VerifyCookie| 0| 3| 0| | 00
 58| TableLock| 0| 4| 0| labels| 00
 59| TableLock| 0| 5| 0| Items| 00
 60| Goto| 0| 2| 0| | 00
</code></pre>
<p>&#x53EF;&#x4EE5;&#x770B;&#x5230;&#x5176;&#x4E2D;&#x9700;&#x8981;&#x5EFA;&#x7ACB;&#x7D22;&#x5F15;&#xFF0C;IdxInsert&#xFF0C;&#x4E8E;&#x662F;&#x5728;sqlite3VdbeExec&#x4E2D;&#x4F1A;&#x8FDB;&#x5165;</p>
<p><strong>OP_IdxInsert&#x5206;&#x652F;</strong>&#xFF0C;&#x7136;&#x540E;</p>
<p><strong>&#x4F1A;&#x8C03;&#x7528;sqlite3BtreeInsert</strong>&#xFF0C;&#x5411;B&#x6811;&#x4E2D;&#x63D2;&#x5165;&#x4E00;&#x4E2A;&#x8282;&#x70B9;&#xFF0C;</p>
<p>&#x6B64;&#x65F6;&#x5982;&#x679C;pPage&#x6EE1;&#x4E86;&#xFF0C;&#x4F1A;&#x6267;&#x884C;<strong>balance</strong>&#x5E73;&#x8861;B&#x6811;&#xFF0C;</p>
<p>&#x5728;&#x8FD9;&#x91CC;&#x9762;&#x5C31;&#x4F1A;<strong>btreeGetPage</strong>&#x53BB;&#x83B7;&#x53D6;&#x53EF;&#x7528;&#x7684;page&#xFF0C;</p>
<p>&#x83B7;&#x53D6;page&#x7684;&#x8FC7;&#x7A0B;&#x6700;&#x7EC8;&#x4F1A;&#x6267;&#x884C;<strong>sqlite3_malloc</strong>&#xFF0C;&#x4E3A;page&#x5206;&#x914D;&#x7A7A;&#x95F4;&#xFF0C;&#x4E00;&#x65E6;&#x5206;&#x914D;&#x5931;&#x8D25;&#xFF0C;&#x5C31;&#x4F1A;&#x5728;<strong>fetch</strong>&#x5904;&#x89E6;&#x53D1;pBase == 0&#x7684;&#x6761;&#x4EF6;&#xFF0C;</p>
<p>&#x4E8E;&#x662F;&#x6267;&#x884C;<strong>sqlite3PcacheFetchStress</strong>&#xFF0C;&#x5728;&#x5176;&#x4E2D;&#x8C03;&#x7528;<strong>pager_write_pagelist</strong>&#x65F6;&#x89E6;&#x53D1;<strong>pPager-&gt;fd == 0</strong>&#x7684;&#x6761;&#x4EF6;&#xFF08;&#x56E0;&#x4E3A;page&#x5728;&#x524D;&#x9762;&#x6CA1;&#x6709;&#x5206;&#x914D;&#x5230;&#x7A7A;&#x95F4;&#xFF09;&#xFF0C;</p>
<p>&#x4E8E;&#x662F;&#x89E6;&#x53D1;<strong>pagerOpenTemp</strong>&#xFF0C;&#x5F80;&#x4E0B;&#x6267;&#x884C;&#x8C03;&#x7528;<strong>unixGetTempname</strong>&#xFF0C;&#x5F97;&#x5230;&#x4E0A;&#x9762;&#x6240;&#x8BF4;&#x7684;&#x90A3;&#x4E2A;&#x4E0D;&#x6B63;&#x786E;&#x7684;&#x6587;&#x4EF6;&#x8DEF;&#x5F84;&#xFF0C;</p>
<p>&#x6267;&#x884C;<strong>sqlite3Osopen</strong>&#x65F6;&#x5C31;&#x4F1A;&#x5931;&#x8D25;&#x3002;</p>
<p>&#x4ECE;&#x4E0A;&#x9762;&#x7684;&#x5206;&#x6790;&#x770B;&#x51FA;&#xFF0C;&#x89E6;&#x53D1;&#x8FD9;&#x4E2A;&#x8DEF;&#x5F84;&#x9700;&#x8981;&#x51E0;&#x4E2A;&#x6761;&#x4EF6;&#xFF1A;</p>
<ul>
<li>&#x6267;&#x884C;&#x7684;sql&#x8BED;&#x53E5;&#x9700;&#x8981;&#x5EFA;&#x7ACB;&#x7D22;&#x5F15;&#xFF0C;</li>
<li>B&#x6811;&#x4E0D;&#x5E73;&#x8861;</li>
<li>&#x6CA1;&#x6709;&#x8BBE;&#x7F6E;&#x8FC7;&#x73AF;&#x5883;&#x53D8;&#x91CF;</li>
<li><p>&#x5206;&#x914D;&#x7684;&#x5185;&#x5B58;&#x4E0D;&#x8DB3;&#x4EE5;&#x65B0;&#x5EFA;&#x65B0;&#x7684;page</p>
<p>&#x6240;&#x4EE5;&#x89E6;&#x53D1;&#x6761;&#x4EF6;&#x8FD8;&#x662F;&#x6BD4;&#x8F83;&#x4E25;&#x683C;&#x7684;&#x3002;</p>
</li>
</ul>
<p>&#x5728;<strong>unixOpenTempname</strong>&#x6267;&#x884C;&#x65F6;&#x7528;&#x4E00;&#x4E2A;&#x53D8;&#x91CF;&#x8BA1;&#x7B97;&#x4E34;&#x65F6;&#x6587;&#x4EF6;&#x7684;&#x6253;&#x5F00;&#x6B21;&#x6570;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x53D1;&#x73B0;&#x786E;&#x5B9E;&#x662F;&#x4E00;&#x6253;&#x5F00;&#x8FD9;&#x6837;&#x7684;&#x6587;&#x4EF6;&#x5C31;&#x4F1A;&#x5931;&#x8D25;&#xFF08;&#x5728;&#x6253;&#x5F00;&#x7B2C;&#x4E00;&#x4E2A;&#x7684;&#x65F6;&#x5019;&#x5C31;&#x5931;&#x8D25;&#xFF09;&#x3002;</p>
<p><strong>&#x89E3;&#x51B3;&#x65B9;&#x6848;(Solution)</strong></p>
<p>&#x90A3;&#x4E48;&#x6700;&#x91CD;&#x8981;&#x7684;&#x4E8B;&#x60C5;&#x6765;&#x4E86;&#xFF0C;&#x600E;&#x4E48;&#x4FEE;&#x590D;&#x5462;&#xFF1F;</p>
<p>&#x65E2;&#x7136;&#x662F;&#x4E34;&#x65F6;&#x6587;&#x4EF6;&#x7684;&#x76EE;&#x5F55;&#x6CA1;&#x6709;&#x5199;&#x6743;&#x9650;&#xFF0C;&#x90A3;&#x5C31;&#x6539;&#x76EE;&#x5F55;&#x5427;&#xFF01;</p>
<p>&#x7FFB;&#x4E86;&#x7FFB;sqlite&#x7684;&#x4E00;&#x4E9B;&#x8D44;&#x6599;&#xFF0C;&#x627E;&#x5230;&#x4E86;&#x8FD9;&#x6837;&#x4E00;&#x4E2A;programa</p>
<p><a href="http://www.sqlite.org/c3ref/temp_directory.html" target="_blank">http://www.sqlite.org/c3ref/temp_directory.html</a></p>
<pre><code class="lang-sql"><span class="hljs-keyword">PRAGMA</span> temp_store_directory = <span class="hljs-string">&apos;your dir&apos;</span>
</code></pre>
<p>&#x8FD9;&#x4E2A;&#x4E1C;&#x897F;&#x4EC5;&#x5BF9;&#x5F53;&#x524D;SqliteConncetion&#x6709;&#x6548;&#xFF0C;</p>
<p>&#x5728;&#x7B2C;&#x4E00;&#x6B21;&#x5EFA;&#x7ACB;sqlite&#x8FDE;&#x63A5;&#x7684;&#x65F6;&#x5019;&#xFF08;&#x6211;&#x662F;&#x91CD;&#x5199;&#x4E86;getReadabelDatabase()&#x65B9;&#x6CD5;&#xFF09;&#xFF0C;&#x8BBE;&#x7F6E;&#x4E00;&#x4E0B;&#x4E34;&#x65F6;&#x6587;&#x4EF6;&#x76EE;&#x5F55;&#xFF0C;like this:</p>
<pre><code class="lang-java"><span class="hljs-keyword">private</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">boolean</span> mainTmpDirSet = <span class="hljs-keyword">false</span>;
<span class="hljs-meta">@Override</span>
    <span class="hljs-function"><span class="hljs-keyword">public</span> SQLiteDatabase <span class="hljs-title">getReadableDatabase</span><span class="hljs-params">()</span> </span>{
        <span class="hljs-keyword">if</span> (!mainTmpDirSet) {
            <span class="hljs-keyword">boolean</span> rs = <span class="hljs-keyword">new</span> File(<span class="hljs-string">&quot;/data/data/com.cmp.pkg/databases/main&quot;</span>).mkdir();
            Log.d(<span class="hljs-string">&quot;ahang&quot;</span>, rs + <span class="hljs-string">&quot;&quot;</span>);
            <span class="hljs-keyword">super</span>.getReadableDatabase().execSQL(<span class="hljs-string">&quot;PRAGMA temp_store_directory = &apos;/data/data/com.cmp.pkg/databases/main&apos;&quot;</span>);
            mainTmpDirSet = <span class="hljs-keyword">true</span>;
            <span class="hljs-keyword">return</span> <span class="hljs-keyword">super</span>.getReadableDatabase();
        } 
        <span class="hljs-keyword">return</span> <span class="hljs-keyword">super</span>.getReadableDatabase();
    }
</code></pre>
<p>&#x7136;&#x540E;&#x518D;&#x53BB;&#x6267;&#x884C;&#x90A3;&#x4E9B;&#x7E41;&#x91CD;&#x7684;&#x67E5;&#x8BE2;&#xFF0C;&#x4F60;&#x4F1A;&#x53D1;&#x73B0;&#x95EE;&#x9898;&#x6D88;&#x5931;&#x4E86;&#xFF0C;</p>
<p>&#x5E76;&#x4E14;sqlite3&#x4F1A;&#x5728;&#x4E0D;&#x9700;&#x8981;&#x8FD9;&#x4E2A;&#x4E34;&#x65F6;&#x6587;&#x4EF6;&#x65F6;&#x81EA;&#x52A8;&#x5220;&#x9664;&#x5B83;&#xFF0C;&#x6240;&#x4EE5;&#x4F60;&#x4E0D;&#x9700;&#x8981;&#x505A;&#x4E00;&#x5957;&#x6E05;&#x7406;&#x903B;&#x8F91;&#x3002;</p>
<p>&#x4E8E;&#x662F;&#x95EE;&#x9898;&#x89E3;&#x51B3;!</p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="cong-yuan-ma-kan-android-zhong-sqlite-shi-zen-mo-tong-guo-cursorwindow-du-db-de.html" class="navigation navigation-prev " aria-label="Previous page: 【源码】CursorWindow读DB">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="../chromium.html" class="navigation navigation-next " aria-label="Next page: Chromium">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"Sqlite在Android上的一个Bug","level":"1.2.2.2","depth":3,"next":{"title":"Chromium","level":"1.2.3","depth":2,"path":"android/chromium.md","ref":"android/chromium.md","articles":[]},"previous":{"title":"【源码】CursorWindow读DB","level":"1.2.2.1","depth":3,"path":"android/sqlite/cong-yuan-ma-kan-android-zhong-sqlite-shi-zen-mo-tong-guo-cursorwindow-du-db-de.md","ref":"android/sqlite/cong-yuan-ma-kan-android-zhong-sqlite-shi-zen-mo-tong-guo-cursorwindow-du-db-de.md","articles":[]},"dir":"ltr"},"config":{"plugins":["disqus","github","toggle-chapters","mathjax","mermaid-gb3"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"disqus":{"useIdentifier":false,"shortName":"ahangchen-blog"},"github":{"url":"https://github.com/ahangchen/windy-afternoon"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"mermaid-gb3":{},"mathjax":{"forceSVG":false,"version":"2.6-latest"},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"toggle-chapters":{}},"theme":"default","author":"陈伟航","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"梦里茶","gitbook":"*"},"file":{"path":"android/sqlite/sqlite-zai-android-shang-de-yi-ge-bug.md","mtime":"2021-10-01T05:23:02.316Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2021-10-03T04:31:53.922Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="https://cdnjs.cloudflare.com/ajax/libs/URI.js/1.16.1/URI.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-disqus/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-github/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-toggle-chapters/toggle.js"></script>
        
    
        
        <script src="https://cdn.staticfile.org/mathjax/2.6.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-mathjax/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-mermaid-gb3/book/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    <script src="../../gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.min.js"></script>

    </body>
</html>

